#{extends 'common/frontMain.html' /}
#{set title:'通过邮箱重置密码页面' /}
<div class="xf_login_centent clr">
	<div class="xf_login_title xf_login_title2">
		<span class="xf_login_title_yhdl">重置密码</span>
	</div>
	<div class="xf_register_email">
		<ul class="xf_register_email_ul clr" id="xf_wyjkview_xxk">
			<li class="xf_con_wyjk_r_liishot xf_con_wyjk_r_liwyhm">通过邮箱重置密码</li>
			<li onClick="byMobile()">通过手机重置密码</li>
		</ul>
		#{form @sendResetEmail(), id:'resetPassword'}
		<div class="xf_con_wyjk_tentultbody">
			<ul class="xf_login_inputsrul xf_login_inputsrul_zhyhm">
				<li>
					<div class="xf_login_inputsrul_l xf_login_inputsrul_lyhm">请输入注册时填写的邮箱：</div>
					<div class="xf_login_inputsrul_r">
						<input class="xf_login_shurk" type="text" id="email" name="email" value="${flash.email}">
					</div>
				</li>
				<li>
					<div class="xf_login_inputsrul_l xf_login_inputsrul_lyhm">验证码：</div>
					<div class="xf_login_inputsrul_r">
						<input class="xf_login_yzm" type="text" name="code" id="code" value="${flash.code}">
						<input type="hidden" name="randomID" id="randomID" />
						<img src="" class="xf_login_yzmimg" id="img" onClick="change()" width="75px" height="28px">
						<a href="javascript:void(0);" onClick="change()" class="xf_login_inputspan">刷新</a>
					</div>
				</li>
				<li>
					<div class="xf_login_inputsrul_l xf_login_inputsrul_lyhm">&nbsp;</div>
					<div class="xf_login_inputsrul_r">
						<a href="javascript:void(0);" onClick="resetPassword()" class="xf_con_inputfbjk">确定</a>
					</div>
				</li>
			</ul>
		</div>
		#{/form}
	</div>
</div>
<!-- 底部阴影 -->
<div class="xf_login_kjyy"></div>
<script type="text/javascript">
	 $(function(){
         var setCode = #{jsAction @setCode()/}
		 $.post(setCode({}),function(data){
			var arr=eval(data);
			var img = arr.img;
			$("#img").attr("src","@{getImg()}?id="+img);	
			$("#randomID").val(img);
		 });
     })
     
     function resetPassword(){
        var email = $("#email").val();
		 
       if(email == ""){
        	alert("请填写邮箱地址");
        	return;
       }else if(!(email).isEmail()){
        	alert("请填写正确的邮箱地址");
        	return;
       }
     
       if($("#code").val() == ''){
            alert("请输入验证码");
            return;
       } 
     
       $("#resetPassword").submit();
    }
      
	function byMobile(){
        window.location.href = "@{resetPasswordByMobile()}";
    }
</script>